package dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DynamicProxyLog implements InvocationHandler {
    private Object implObj;

    public DynamicProxyLog(Object implObj) {
        this.implObj = implObj;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("为业务方法追加日志，开始...");
        Object invoke = method.invoke(implObj,args);
        System.out.println("为业务方法追加日志，结束...");
        return invoke;
    }
}
